package com.tangcl.module_mine.network

import com.tangcl.module_base.network.RetrofitManager
import com.tangcl.module_commom.network.BaseRepository
import com.tangcl.module_commom.support.StateLiveData

/**
 * Created by TCL on 2021/10/15
 *
 * description:使用封装后的Repo
 */
//class MineLoginRepo(private val service: MineApiService) : BaseRepository() {
class MineLoginRepo : BaseRepository() {
    //---start 仿照--
    private lateinit var mService: MineApiService

    init {
        mService = RetrofitManager.initRetrofit().getService(MineApiService::class.java)
    }
    //---end 仿照--

    suspend fun login(
        userName: String,
        password: String,
        stateLiveData: StateLiveData<MineLoginRepo>
    ) {
        val paramsMap = HashMap<String, String>()
        paramsMap["username"] = userName
        paramsMap["password"] = password
//        executeResp({ service.doLoginRepo(paramsMap) }, stateLiveData)
        executeResp({ mService.doLoginRepo(paramsMap) }, stateLiveData)
    }

}